package com.shadow.demo.excel.demo.v2.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.shadow.demo.common.enums.excel.ImportCheckEnum;
import com.shadow.demo.excel.demo.v2.listener.annotation.ImportCheck;
import lombok.Data;

import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 导入对象
 * */
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class EasyExcelImportVO {

    @ImportCheck(
            type = { ImportCheckEnum.NOT_NULL, ImportCheckEnum.LENGTH },
            minLength = 2,
            maxLength = 3
    )
    @Size(min = 2, max = 3)
    @ExcelProperty("姓名")
    private String name;

    @ExcelProperty("年龄")
    private Integer age;

    @ExcelProperty("资产")
    private BigDecimal assets;

//    @EnumClass(PersonalityEnum.class)
//    @ExcelProperty(value = "性格", converter = StringEnumsConverter.class)
    @ImportCheck(type = ImportCheckEnum.NOT_NULL)
    @ExcelProperty("性格")
    private String personality;

    @ExcelProperty("密码")
    private String password;

    @ExcelProperty("创建时间")
    private LocalDateTime createTime;
}
